package com.vexelcorp.simpleFragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class ImageViewFrag extends Fragment {
	
	private static final String DEBUG="DEBUG";
	static int mCurrentPosition;
	
	public static ImageViewFrag newInstance(int position){
		ImageViewFrag imageViewFrag = new ImageViewFrag();
		mCurrentPosition = position;
		return imageViewFrag;
		
	}
	
	public int getCurrentPosition(){
		return mCurrentPosition;
	}
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
/*		View view = inflater.inflate(R.layout.imageview_frag, null);
		return view;*/
		
		ImageView view = new ImageView(getActivity());
		int imageResource = R.drawable.food_1;
		switch (mCurrentPosition) {
		case 0:
			imageResource = R.drawable.food_1;
			break;
			
		case 1:
			imageResource = R.drawable.food_2;
			break;
		case 2:
			imageResource = R.drawable.food_3;
			break;
			
		case 3:
			imageResource = R.drawable.food_4;
			break;
			
		case 4:
			imageResource = R.drawable.food_5;
			break;
			
		case 5:
			imageResource = R.drawable.food_6;
			break;
			
		case 6:
			imageResource = R.drawable.food_7;
			break;
			
			
		case 7:
			imageResource = R.drawable.food_8;
			break;
			
		}
		Log.d(DEBUG, "case :" + imageResource);
		view.setImageResource(imageResource);
		view.setScaleType(ScaleType.CENTER_CROP);
		return view;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
	
		
	}

}
